          SUBROUTINE (OID,GEN,OLD.PN,NEW.PN,PRC.BR,REMOVE.EDI.CMTS)
** Version# 2.0001[3] - 01/02/2014 - 03:55pm - TSMITH - eclipse
*** V2.0001 Change - Custom Coding . - 01/02/2014 - TSMITH - eclipse

*** Subroutine - OE.REMOVE.STD.CMTS
*-------------------------------------------------------------------------*
*** Description:   This routine will remove all standard system comments
*** from the active LD array to allow for a product change.
*-------------------------------------------------------------------------*
*** OID         - The current order to add the product to.         [IN]
*** GEN         - The current gen of the order                     [IN]
*** OLD.PN      - The original product on the line item            [IN]
*** NEW.PN      - The New product being put on the line item       [IN]
*** PRC.BR      - The price branch of the order                    [IN]
*** REMOVE.EDI.CMTS - Whether EDI comments should also stripped    (IN)
*-------------------------------------------------------------------------*
*** Common: This routine requires LD to be active - LD Will be updated
*-------------------------------------------------------------------------*

          MODE   = OID[1,1]

          SHP.BR = LED(2)<1,GEN,2>

          * Find if the old item was hazardous or nonstock
          READ OLD.PRD FROM PRDFILE,OLD.PN ELSE OLD.PRD = ''
          OLD.LEAD     = (OLD.PRD<198>=1)
          OLD.NONSTOCK = (OLD.PRD<3>=2 OR OLD.PRD<3>=4)
          OLD.HAZZARD  = (OLD.PRD<80,3>#'')
          LOCATE "1" IN LD(2)<1> SETTING ONE.POS ELSE ONE.POS = 0

          * Clean out Nonstock and Hazard Comments, even if
          * they re-entered the same PN to avoid duplication.
          IF ONE.POS THEN
             IF MODE='S' THEN
                * If the previos product was a nonstock item...
                IF OLD.NONSTOCK THEN
                   * ...find and remove the nonstock comment.
                   CTRB.ID = 'NONSTOCK.COMMENT~':SHP.BR
                   READ CMNTS FROM CTRBFILE,CTRB.ID ELSE CMNTS = ''
                   NONSTOCK.COMMENTS.API CMNTS,SHP.BR
                   IF CMNTS THEN
                      CMT.CT = DCOUNT(CMNTS<1>,VM)
                      FOR CX = 1 TO CMT.CT
                         CMNT = CMNTS<1,CX>
                         GOSUB REM.ONE
                      NEXT CX
                   END
                END


                * If the previos product was a nonstock item...
                IF OLD.LEAD THEN
                   * ...find and remove the nonstock comment.
                   CTRB.ID = 'LEAD.PROD.COMMENT~':SHP.BR
                   READ CMNTS FROM CTRBFILE,CTRB.ID ELSE CMNTS = ''
                   NONSTOCK.COMMENTS.API CMNTS,SHP.BR
                   IF CMNTS THEN
                      CMT.CT = DCOUNT(CMNTS<1>,VM)
                      FOR CX = 1 TO CMT.CT
                         CMNT = CMNTS<1,CX>
                         GOSUB REM.ONE
                      NEXT CX
                   END
                  END






                * If the previos product was a hazardous item...
                IF OLD.HAZZARD THEN
                   * ...find and remove the hazardous comment.
                   READ CMNT FROM CTRLFILE,'HAZARD.COMMENT' THEN
                      GOSUB REM.ONE
                   END
                END

                * Remove the Procure comments
                READ CMNT FROM CTRLFILE,'PROCURE.COMMENT' THEN
                   GOSUB REM.ONE
                END
             END

             CM.CT = DCOUNT(LD(3)<1,ONE.POS>,SVM)
             FOR CM.LP = CM.CT TO 1 STEP -1
                CMT = TRIM(OCONV(LD(3)<1,ONE.POS,CM.LP>,'MCU'))
                BEGIN CASE
                CASE CMT[1,24] = 'COULD NOT MATCH ON PART#'
                   IF REMOVE.EDI.CMTS THEN
                      LD(3) = DELETE(LD(3),1,ONE.POS,CM.LP)
                   END
                CASE CMT[1,9] = '* SUB FOR'
                   * Remove substitute comment
                   LD(3) = DELETE(LD(3),1,ONE.POS,CM.LP)
                CASE CMT[1,6] = 'YOUR #' OR CMT[1,13] = 'YOUR LOCATION'
                   * In case they entered the same pn twice BUT
                   * the second time used a cus pn to pull it up
                   IF REMOVE.EDI.CMTS THEN CONTINUE
                   LD(3) = DELETE(LD(3),1,ONE.POS,CM.LP)
                END CASE
             NEXT CM.LP
          END

          *** In case the product has a family comment, strip it out.
          LOCATE "F" IN LD(2)<1> SETTING CPOS THEN
             LD(2) = DELETE(LD(2),1,CPOS)
             LD(3) = DELETE(LD(3),1,CPOS)
          END

          *** In case the product has a tag-along comment, strip it out.
          LOCATE "A" IN LD(2)<1> SETTING CPOS THEN
             LD(2) = DELETE(LD(2),1,CPOS)
             LD(3) = DELETE(LD(3),1,CPOS)
          END

          RETURN
*-------------------------------------------------------------------------*
REM.ONE:  *** Remove one comment from the list.
          IF CMNT # "" THEN
             LOCATE CMNT IN LD(3)<1,ONE.POS> SETTING CLOC THEN
                LD(3) = DELETE(LD(3),1,ONE.POS,CLOC)
             END
          END
          RETURN
!TSMITH~01/02/14~15:55
